class AuctingsController < ApplicationController
  # GET /auctings
  # GET /auctings.json
  def index
    @auctings = Aucting.all

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @auctings }
    end
  end

  # GET /auctings/1
  # GET /auctings/1.json
  def show
    @aucting = Aucting.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @aucting }
    end
  end

  # GET /auctings/new
  # GET /auctings/new.json
  def new
    @aucting = Aucting.new

    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @aucting }
    end
  end

  # GET /auctings/1/edit
  def edit
    @aucting = Aucting.find(params[:id])
  end

  # POST /auctings
  # POST /auctings.json
  def create
    @aucting = Aucting.new(params[:aucting])

    respond_to do |format|
      if @aucting.save
        format.html { redirect_to @aucting, notice: 'Aucting was successfully created.' }
        format.json { render json: @aucting, status: :created, location: @aucting }
      else
        format.html { render action: "new" }
        format.json { render json: @aucting.errors, status: :unprocessable_entity }
      end
    end
  end

  # PUT /auctings/1
  # PUT /auctings/1.json
  def update
    @aucting = Aucting.find(params[:id])

    respond_to do |format|
      if @aucting.update_attributes(params[:aucting])
        format.html { redirect_to @aucting, notice: 'Aucting was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: "edit" }
        format.json { render json: @aucting.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /auctings/1
  # DELETE /auctings/1.json
  def destroy
    @aucting = Aucting.find(params[:id])
    @aucting.destroy

    respond_to do |format|
      format.html { redirect_to auctings_url }
      format.json { head :no_content }
    end
  end
end
